Skip to content

Follow new chat messages after the chat returns from the background - #3374

Open
StylianosGakis wants to merge 1 commit into
developfrom
fix/chat-scroll-to-new-message-after-background
Open

StylianosGakis wants to merge 1 commit into
developfrom
fix/chat-scroll-to-new-message-after-background

Conversation

@StylianosGakis

Copy link
Copy Markdown
Member
🤖 AI description

A chat left open in the background stopped scrolling to new messages. Reproduce on develop: open a conversation at the newest message, press Home, wait about 25 seconds, have support reply, return. The reply is loaded but sits below the visible area, and the list stays stuck from then on, even for messages sent from that screen.

ScrollToBottomEffect is keyed on the list state only, so it kept the first LazyPagingItems it was called with. The presenter stops 5 seconds after the screen is backgrounded, and on return the screen gets a new LazyPagingItems. The effect went on observing the old one, hit its one second timeout and never scrolled. itemSnapshotList is snapshot state, but of that one instance, so the fix reads the list through rememberUpdatedState, as the function already does for the latest message.

Checked on a Pixel 6 Pro with the scenario above: stuck before, follows after. No test here: the module has no Compose UI test setup on develop.

After the chat screen had been in the background for more than a few seconds, newly arrived messages stopped being scrolled into view for as long as the screen stayed open. The presenter restarts on return and hands the screen a new LazyPagingItems, but ScrollToBottomEffect kept waiting on the instance it captured when it first launched, so it never saw the new message and timed out. The effect now reads the current list through rememberUpdatedState.
@StylianosGakis
StylianosGakis marked this pull request as ready for review November 13, 2026 16:17
@StylianosGakis
StylianosGakis requested a review from a team as a code owner November 13, 2026 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant